package zhy.UseViewGroupCustomTest;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class UseViewGroupCustomTestActivity extends Activity {

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        LinearLayout content=new LinearLayout(this);
        content.setOrientation(LinearLayout.HORIZONTAL);
        content.setBackgroundColor(Color.GREEN);
        setContentView(content);
        TextView text=new TextView(this);
        text.setText("abcabc");
        text.setBackgroundColor(Color.RED);
        content.addView(text);
        
        //ViewGroup my=new MyViewGroup(this);
        ViewGroup my=new MyViewGroupCanScroll(this);
        my.setBackgroundColor(Color.BLUE);
        content.addView(my);
        
        Button button=new Button(this);
        String str="0123456789012345678901234567890123456789";
        button.setText(str);
        //button.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
        //button.setLayoutParams(new LayoutParams(240,240));
        my.addView(button);
        
        for(int i=0;i<=10;i++)
        {
        	 Button but=new Button(this);
             but.setText(i+"---"+str.substring(0, (int)(Math.random()*40)));
             my.addView(but);
        }
    }
}